FROM golang:1.15 as builder

WORKDIR /root

ADD . .
RUN go env -w GOPROXY=https://goproxy.cn,direct
RUN go mod vendor
RUN go build -o main

FROM centos
WORKDIR /root
COPY --from=builder /root/main /root/main
RUN ln -s /root/main /bin/main
CMD ["main", "api"]